package cn.zdq.demo_net;

import android.app.Application;

import cn.zdq.lib_net.RxHttpUtils;
import cn.zdq.lib_net.config.OkHttpConfig;
import okhttp3.OkHttpClient;

/**
 * @Description:
 * @Author: zhoudequn
 * @CreateDate: 2021/11/18 09:53
 */
public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        RxHttpUtils.getInstance().init(this)
                .config()
                .setBaseUrl("https://www.wanandroid.com/")
                .setOkClient(createOkhttpClient());
    }

    private OkHttpClient createOkhttpClient() {
        OkHttpClient okHttpClient = new OkHttpConfig.Builder(this)
                .setCache(false)
                .setReadTimeout(10)
                .setWriteTimeout(10)
                .setConnectTimeout(60)
                .setDebug(BuildConfig.DEBUG)
                .build();
        return okHttpClient;
    }
}
